#ifndef BATTLEPAGE_H
#define BATTLEPAGE_H

#include <QWidget>
#include <QPainter>
#include <QMouseEvent>
#include <QMessageBox>
#include <QMap>
#include <QRandomGenerator>
#include <QTimer>
#include <QTime>
#include <sys/time.h>
#include <QDebug>
#include <iostream>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "../ConsoleApp/Algorithm.h"
#include "../ConsoleApp/CheckerBoard.h"

enum gameMode {local_none, local, network_none, network, ai};

using namespace std;

class GameEvent {
public:
    ServerMode();
    ClientMode();
};

namespace UI {
    class BattlePage;
}

class BattlePage : public QWidget {
public:
    void initialize();
    void SetGameMode(int Mode);

    ~BattlePage();

protected:
    void paintEvent(QPaintEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;

private:
    int cursorRow;
    int cursorCol;
    int gameMode;
    UI::BattlePage *ui;
    CheckerBoard checkerBoard;
    QPoint chessboard[21][21];
    GoBangAlgorithm goBangAlgorithm;
    GameEvent gameEvent;
    int yourid;
    int anotherid;

    char* StringToCharArray(string str);
    int* NetWorkTranslation(char* arr);
};
#endif // BATTLEPAGE_H
